#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;
int lengthOfLongestSubstring(string s)
{
    if (!s.size()) return 0;
    bool vis[1000] = { false };
    int begin = 0, end = 0;
    int maxlen = -1;
    while (end < s.size())
    {
        while (end < s.size() && !vis[s[end]])
        {
            vis[s[end]] = true;
            end++;
        }
        int tmp = end - begin;
        if (tmp > maxlen) maxlen = tmp;
        while (s[end] != s[begin])
        {
            vis[s[begin]] = false;
            begin++;
        }
        begin++, end++;
    }
    return maxlen;
}
int main()
{
    cout << lengthOfLongestSubstring("ajssija as");
	return 0;
}